Method and appratus for implementing microkernel architecture of industrial server

ABSTRACT

Provided is a method and apparatus for implementing microkernel architecture of industrial server. The method includes calculation of dependency of control programs according to a microkernel task type weight and a microkernel task priority weight and/or a control program running time weight prior to startup of a system, and determination of the number of the control programs running on each physical core and each control program running on multiple physical cores according to the dependency.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to a Chinese patent application No.201811296334.2 filed by the applicant “KYLAND TECHNOLOGY CO., LTD” onNov. 1, 2018 and entitled “METHOD FOR IMPLEMENTING MICROKERNELARCHITECTURE OF INDUSTRIAL SERVER”, the disclosure of which isincorporated herein by reference in its entirety.

TECHNICAL FIELD

The embodiments of the present disclosure relates to the technical fieldof industrial servers and, in particular, to a method and apparatus forimplementing microkernel architecture of an industrial server.

BACKGROUND

A virtual operating system (e.g., Core i7) based on industrial serverhardware supports four physical cores. One virtual machine, that is, onemicro-control kernel including a Programmable Logic Controller (PLC),runs on each core.

However, that only one PLC can run on one core wastes resources and alsolimits executable functions. In addition, the scheduling mode ofmulti-core PLC includes a priority-based scheduling algorithm applied inservice scenarios with high real-time requirements and a timetable-basedscheduling algorithm applied in service scenarios with low real-timerequirements. In a scenario with complex service requirements, any ofthe above scheduling algorithms can hardly meet users' servicerequirements and would cause low utilization of CPU resources.

SUMMARY

The embodiments of the present disclosure provide a method and apparatusfor implementing microkernel architecture of an industrial server, toachieve the real-time control and free combination of microkernels ofthe industrial server at the industrial site layer.

Embodiments of the present disclosure provide a method for implementingmicrokernel architecture of industrial server, where the method isapplied to an industrial server, an operating system kernel based onindustrial server hardware supports a plurality of physical cores, andthe method includes the following steps:

operating an operating system kernel to generate schedulingconfiguration information according to a microkernel task type weightand a microkernel task priority weight and/or a control program runningtime weight corresponding to each control program of a plurality ofcontrol programs prior to startup of a system, where the schedulingconfiguration information includes the number of control programs of themultiple control programs running on each physical core, a schedulingalgorithm for all the control programs running on each physical core,and at least one control program of the plurality of control programsrunning on more than one of the plurality of physical cores;

operating the operating system microkernel to configure the plurality ofcontrol programs running on the operating system kernel according to thescheduling configuration information; and

operating the operating system microkernel to start the configuredcontrol programs.

In an embodiment, the step of operating the operating system kernel togenerate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol program of the plurality of control programs includes:

calculating dependency of the multiple control programs according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol program; and

generating the scheduling configuration information according to thedependency.

In an embodiment, the step of calculating the dependency of the multiplecontrol programs according to the microkernel task type weight and themicrokernel task priority weight and/or the control program running timeweight corresponding to each control program includes:

calculating the dependency according to the microkernel task typeweight, the microkernel task priority weight and the control programrunning time weight; or

calculating the dependency according to the microkernel task type weightand the microkernel task priority weight; or

calculating the dependency according to the microkernel task type weightand the control program running time weight.

In an embodiment, the step of operating the operating system kernel toconfigure control programs running on the operating system kernelaccording to the scheduling configuration information includes:

virtualizing hardware through a virtual machine monitoring program, andconfiguring more than one of the control programs on at least one of theplurality of physical cores according to the scheduling configurationinformation; and/or

configuring the scheduling algorithm for all the control programsrunning on the each physical core according to the schedulingconfiguration information, wherein the scheduling algorithm comprises atimetable-based scheduling algorithm or a priority-based schedulingalgorithm; and/or

virtualizing the plurality of physical cores, obtaining at least twocontrol programs from each of the at least one control program andconfiguring the obtained at least two control programs originating fromeach of the at least one control program on more than one of theplurality of physical cores according to the scheduling configurationinformation.

In an embodiment, the step of operating the operating system kernel togenerate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol program of the control programs includes:

generating the scheduling configuration information according to amicrokernel task type, and a microkernel task priority and/or a controlprogram running time of the each control program using a coarse-grainedlock scheduling method, where in the coarse-grained lock schedulingmethod, the each physical core corresponds to one lock, one controlprogram is determined from control programs on a single one of theplurality of physical cores according to a timetable-based schedulingalgorithm or a priority-based scheduling algorithm, the control programobtains the lock corresponding to the single one of the plurality ofphysical cores, exclusively occupies the single one of the plurality ofphysical cores, and executes a kernel mode operation; or

generating the scheduling configuration information according to themicrokernel task type, and the microkernel task priority and/or thecontrol program running time of the each control program using afine-grained lock scheduling method; where in the fine-grained lockscheduling method, the each physical core corresponds to the one lock,control programs are obtained from the at least one control programaccording to computing resources required by the at least one controlprogram and are configured on respective ones of the plurality ofphysical cores according to the dependency among control programs, eachof the control programs acquires a lock corresponding to the respectiveone of the plurality of physical cores running the each of the controlprograms, the control programs having locks concurrently execute thekernel mode operation on the respective ones of the plurality ofphysical cores running the control programs so as to be executed inparallel.

In an embodiment, the timetable-based scheduling algorithm includes:

setting a plurality of timers, where a duration of a first timer is amain frame time, a second timer is sequentially started for each of aplurality of time windows within the main frame time, and a duration ofthe second timer is the same as a duration of each of the plurality oftime windows successively; and

scheduling control programs according to a timetable while starting thefirst timer and the second timer with the main frame time as a period,scheduling a next one of control programs once the second timer expires,and starting a next period once the first timer expires, wherein thetimetable includes start time and end time of each of the plurality oftime windows and the respective control programs corresponding to theplurality of time windows.

In an embodiment, the priority-based scheduling algorithm includes:

traversing a priority primary index number bitmap to determine a primaryindex number corresponding to a highest priority;

traversing a priority secondary index number bitmap corresponding to theprimary index number to determine a secondary index number correspondingto the highest priority; and

calculating the highest priority based on the primary index number andthe secondary index number, and determining a control programcorresponding to the highest priority.

In an embodiment, the operating the operating system kernel to generatethe scheduling configuration information according to the microkerneltask type weight and the microkernel task priority weight and/or thecontrol program running time weight corresponding to each controlprogram of the plurality of control programs includes:

operating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and/or the control program runningtime weight corresponding to the each control program, and a servicerequirement of the each control program.

In an embodiment, the scheduling configuration information furtherincludes a trigger condition and/or service parameter among the controlprograms.

In an embodiment, the scheduling configuration information furtherincludes a plurality of control subprograms of each control program, oneor more physical cores running the control subprograms, and a triggercondition and/or service parameter among the control subprograms. Thecontrol subprograms of each control program run on the one or morephysical cores.

In an embodiment, the step of operating the operating system kernel togenerate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to the eachcontrol program as well as service requirements of the each controlprograms further includes:

for the each control program, operating the operating system kernel todivide the each control program into multiple control subprogramsaccording to a resource requirement of the each control program andcomputing resources of each microkernel; and

operating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weightand the microkernel task priority weight and/or the control programrunning time weight corresponding to each control subprogram, and aservice requirements of each control subprogram.

In an embodiment, for each control program, the step of operating theoperating system kernel to divide each control program into multiplecontrol subprograms according to the resource requirement of the eachcontrol program and computing resources of each microkernel includes:

for the each control program, operating the operating system kernel todivide the each control program into multiple control subprogramsaccording to a computation burden of the each control program and aparameter for weighting computational capability of each microkernel inthe plurality of physical cores; or

for the each control program, operating the operating system kernel todivide the each control program into multiple control subprogramsaccording to the number of I/O interfaces of the each control programand the number of I/O interfaces of the each microkernel in theplurality of physical cores.

In an embodiment, the step of operating the operating system kernel togenerate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol program of the control programs as well as a service requirementof the each control program includes:

operating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weightand the microkernel task priority weight and/or the control programrunning time weight corresponding to the each control program, theservice requirement of the each control programs, and basic programblocks of the system. The scheduling configuration information furtherincludes: all basic program blocks in each control program, and atrigger condition and/or service parameter among the basic programblocks in each control program.

In the embodiments of the present disclosure and according to a userdefinition, dependency of control programs is calculated according to amicrokernel task type weight and a microkernel task priority weightand/or a control program running time weight prior to startup of asystem, the number of control programs running on each physical core isdetermined according to the dependency, and each control program runs onmultiple physical cores according to the dependency. The user-definedconfiguration is not limited to a single physical core controlling aplurality of microkernel time slices and a single microkernel occupyingcomputing resources to perform an allocation across physical cores. Thepresent disclosure achieves the real-time control and free combinationof microkernels of the industrial server at the industrial site layer.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a flowchart of a method for implementing microkernelarchitecture of industrial server according to an embodiment of thepresent disclosure.

FIG. 2 is a structural diagram of an industrial server according to anembodiment of the present disclosure.

FIG. 3 is a schematic diagram of coarse-grained lock schedulingaccording to an embodiment of the present disclosure.

FIG. 4 is a schematic diagram of fine-grained lock scheduling accordingto an embodiment of the present disclosure.

FIG. 5 is a schematic diagram of a timetable according to an embodimentof the present disclosure.

FIG. 6 is a schematic diagram of a priority index number bitmapaccording to an embodiment of the present disclosure.

FIG. 7 is a flow chart of a method for implementing microkernelarchitecture of industrial server according to an embodiment 4 of thepresent disclosure.

FIG. 8 is a schematic diagram of cooperation among control programsaccording to an embodiment of the present disclosure.

FIG. 9 is a schematic diagram of cooperation among control subprogramsaccording to an embodiment of the present disclosure.

FIG. 10 is a schematic diagram of cooperation among basic program blocksaccording to an embodiment of the present disclosure.

FIG. 11 is a structural diagram of an apparatus for implementingmicrokernel architecture of industrial server according to an embodimentof the present disclosure.

FIG. 12 is a structural diagram of an industrial server according to anembodiment of the present disclosure.

DETAILED DESCRIPTION

According to the present disclosure, a single microkernel runs on asingle physical core, or the single microkernel can utilize thecomputing resources of the only single physical core, which results inthe inefficient utilization of physical core computing resources, in theembodiments of the present disclosure and according to a userdefinition, dependency of control programs is calculated according to amicrokernel task type weight and a microkernel task priority weightand/or a control program running time weight prior to startup of asystem, the number of control programs running on each physical core isdetermined according to the dependency and each control program runs onmultiple physical cores according to the dependency. The user-definedconfiguration is not limited to a single physical core controlling aplurality of microkernel time slices and a single microkernel occupyingcomputing resources to perform an allocation across physical cores. Thepresent disclosure achieves the real-time control and free combinationof microkernels of the industrial server at the industrial site layer.

The embodiments of the present disclosure will be described hereinafterin detail with reference to the accompanying drawings and embodiments.It is to be understood that the specific embodiments described hereinare merely to illustrate, but not to limit the embodiments of thepresent disclosure. It is to be further noted that for convenience ofdescription, only some but not all structures related to the embodimentsof the present disclosure are shown in accompanying drawings.

Embodiment 1

FIG. 1 is a flowchart of a method for implementing microkernelarchitecture of industrial server according to an embodiment of thepresent disclosure. FIG. 2 is a structural diagram of an industrialserver according to an embodiment of the present disclosure. It is canbe seen that the industrial server includes: industrial server hardware,an operating system kernel based on the industrial server hardware, anda plurality of physical cores supported by the operating system kernel.A plurality of virtual machines may run on each physical core, and eachvirtual machine corresponds to one microkernel. Control programs run onthe microkernels, that is, more than one control program may run on eachphysical core. In order to have multiple control programs running on onephysical core, the embodiment of the present disclosure employs thevirtualization technology to obtain multiple virtualized microkernels onthe basis of the operating system. The control programs running onrespective microkernels are scheduled by the operating system kernel. Inan example, among a total of three physical cores a, b, and c, threecontrol programs a1, a2 and a3 run on the physical core a, three controlprograms b1, b2 and b3 run on the physical core b, and three controlprograms c1, c2 and c3 run on the physical core c.

In the present embodiment, a kernel is a microkernel when part ofcontent of services is removed from the kernel to outside. A microkerneloperating system provides only the most basic and necessary services inthe kernel, such as Inter-Process Communication (IPC), memory managementand task scheduling. Other services, including drivers, file systems andnetworks, are implemented in the user mode. The service components runin respective independent address spaces instead of sharing an addressspace. Most microkernel operating systems process requests throughmessage transmission between service modules. For example, a modulesends a request for more memory space and transmits the request throughthe kernel to the service that processes the request. After theprocessing of the request is completed, a result is transmitted backthrough the kernel.

The method for implementing microkernel architecture of industrialserver in the present embodiment may be performed by an operating systemkernel, and is specifically performed by a virtual machine monitorrunning on the operating system kernel. The method includes the stepsdescribed below.

In step 101, the operating system kernel generates schedulingconfiguration information according to a microkernel task type weightand a microkernel task priority weight and/or a control program runningtime weight corresponding to each control program of multiple controlprograms prior to startup of a system; where the schedulingconfiguration information includes the number of control programsrunning on each physical core, a scheduling algorithm for all thecontrol programs running on each physical core, and at least one controlprogram running on more than one physical cores.

In the present embodiment, each physical core may have multiple controlprograms running thereon. These control programs have a same runningperiod or different running periods. In an example, with reference toFIG. 2, three control programs run on each of physical cores a, b and c.Specifically, three control programs a1, a2 and a3 run on the physicalcore a; three control programs b1, b2 and b3 run on the physical core b;and three control programs c1, c2 and c3 run on the physical core c.Control programs a1, a2 and a3 may have the same running period, controlprograms b1, b2 and b3 may have different running periods, and runningperiods of control programs c1 and c2 are the same but are differentfrom the running period of c3. The control programs running on eachphysical core may be scheduled with a configured scheduling algorithm.The scheduling algorithm includes a timetable-based scheduling algorithmor a priority-based scheduling algorithm. Different physical cores maybe configured with different scheduling algorithms. One control programmay run on one or more physical cores. It can be seen that multiplecontrol programs may run on one physical core, where each of the controlprograms may be a control program with complete functions or a controlprogram with part of functions of one control program; when one controlprogram is configured to run on multiple physical cores, the controlprogram runs independently on each physical core, that is, the controlprogram participates in the scheduling of each physical core running thecontrol program; and different physical cores may be configured withdifferent scheduling algorithms and do not affect each other.

An operating system kernel calculates the dependency of control programsaccording to the microkernel task type weight corresponding to eachcontrol program, and the microkernel task priority weight correspondingto each control program and/or the control program running time weightcorresponding to each control program, and generates schedulingconfiguration information according to the dependency. The calculationof the dependency includes: calculating the dependency according to themicrokernel task type weight, the microkernel task priority weight andthe control program running time weight; or calculating the dependencyaccording to the microkernel task type weight and the microkernel taskpriority weight; or calculating the dependency according to themicrokernel task type weight and the control program running timeweight. The microkernel task corresponding to a control program refersto a task for running the control program of the microkernel. Therunning time corresponding to a control program refers to a time sliceallocated for the control program.

As mentioned above, each physical core may have multiple controlprograms running thereon. The control programs have a same runningperiod or different running periods. That is, the control programsshares one physical core, and when one of the control programs needs toexecute a kernel mode operation, the physical core serves this controlprogram. In order to exclusively use the physical core, any controlprogram that needs to execute the kernel mode operation is required toapply for a lock. Only the control program that has the lock can use thephysical core to execute the kernel mode operation. According to thegranularity size of computing resources required by the controlprograms, scheduling methods are classified into a coarse-grained lockscheduling method and a fine-grained lock scheduling method.

FIG. 3 is a schematic diagram of coarse-grained lock schedulingaccording to an embodiment of the present disclosure. The coarse-grainedlock scheduling refers to that one physical core corresponds to one lockand the control program that has the lock exclusively occupies theentire physical core. Therefore, only one control program uses thephysical core to execute the kernel mode operation at a time. Othercontrol programs that need to execute the kernel mode operation can onlywait to be scheduled to acquire the lock. When a coarse-grained lockscheduling method is adopted, the scheduling algorithm for the controlprograms on a single physical core includes the timetable-basedscheduling algorithm or the priority-based scheduling algorithm. In anexample, with reference to FIG. 2, there are a total of three physicalcores a, b and c. Each physical core corresponds to one lock and thecoarse granularity means that scheduling within a physical core iscarried out on the basis of one complete control program. Three controlprograms a1, a2 and a3 run on the physical core a, and only one controlprogram can use the physical core to execute the kernel mode operationat a time. The scheduling may be carried out among control programs a1,a2 and a3 on the basis of the timetable-based scheduling algorithm orthe priority-based scheduling algorithm, to determine which controlprogram acquires the lock of the physical core a. Similarly, thescheduling may be carried out among three control programs b1, b2 and b3running on the physical core b, and among three control programs c1, c2and c3 running on the physical core c in the above-mentioned way, so asto acquire the right of use of the locks corresponding to respectivephysical cores and then to occupy the physical core to execute thekernel mode operation.

FIG. 4 is a schematic diagram of fine-grained lock scheduling accordingto an embodiment of the present disclosure. When a control program needsa large number of computing resources of a kernel service, a kernel modeoperation of the control program may be performed by multiple physicalcores jointly. The single control program is divided into a plurality ofcontrol programs according to different control program granularitiesand the control programs are allocated to different physical cores. Thephysical cores simultaneously execute the kernel mode operation, suchthat the plurality of control programs is executed concurrently.According to the task type of each microkernel, control programs may beclassified into a plurality of types, including Inter-ProcessCommunication (IPC), memory management and task scheduling. The presentembodiment adopts a two-layer clipping algorithm to clip and classifycontrol programs. The first layer clipping algorithm clips the pluralityof control programs into the least schedulable program sets, eachlasting several periods, according to running time, which reduces thesystem overhead for scheduling control programs. The second layerclipping algorithm, based on the results of control program clipping onthe first layer, further clips control programs into several controlprograms sets with different priority levels, which allows controlprograms to run in a more reliable and more real-time environment.Finally, dependency of the plurality of control programs is calculated.The calculation process may be performed in combination with themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight. Control programs withhigh dependency are combined and allocated to the same physical core,and control programs with low dependency are allocated to differentphysical cores. The plurality of physical cores jointly executes thekernel mode operation to complete the control programs.

The clipping algorithm provided by the present embodiment is not limitedto the two-layer clipping algorithm, and may further include thealgorithm described below. For a control program, multiple controlprograms are obtained from the control program, and are clipped intoseveral control programs with different priority levels, which allowsthe control programs to run in a more reliable and more real-timeenvironment. Finally, the dependency of the plurality of controlprograms is calculated, the calculation process may be performed incombination with the microkernel task type weight and the microkerneltask priority weight and/or the control program running time weight.Control programs with high dependency are combined and allocated to thesame physical core, and control programs with low dependency areallocated to different physical cores. The plurality of physical coresjointly executes the kernel mode operation to complete control programs.

In an example, with reference to FIG. 2, there are a total of threephysical cores a, b and c. Each physical core corresponds to one lockand the fine granularity means that the plurality of control programsoriginate from one control program and then the plurality of controlprograms are allocated to different physical cores according todependency between the control programs, each physical core scheduling acontrol program and other control programs together. Control programsb1, b2 and b3 run on the physical core b and control programs c1, c2 andc3 run on the physical core c, where b1 and b2 originate from a samecontrol program, and c1 and c2 originate from a same control program. Asmentioned above, the control programs may be split by using a two-layerclipping algorithm or other algorithms, and, according to thedependency, allocation is performed among physical cores where thecontrol programs are located. That is, b1 and b2 are allocated to thesame physical core b due to their high dependency, and c1 and c2 areallocated to the same physical core c due to their high dependency.Therefore, after the allocation based on the granularity of controlprograms, a same control program is allocated to two physical cores.Control programs within each physical core may be scheduled using thetimetable-based scheduling algorithm or the priority-based schedulingalgorithm, and a control program that acquires the right to use the lockwill occupies the physical core to execute the kernel mode operation.

In an embodiment, the plurality of control programs corresponding to onecontrol program are clipped into several control programs with differentlengths of running time, which allows the control programs to run in amore reliable and more real-time environment. Finally, the dependency ofthe plurality of control programs is calculated, the calculation processmay be performed in combination with the microkernel task type weightand the microkernel task priority weight and/or the control programrunning time weight. Control programs with high dependency are combinedand allocated to the same physical core, and control programs with lowdependency are allocated to different physical cores. The plurality ofphysical cores jointly executes the kernel mode operation to completethe control programs.

In general, control programs to be performed at the industrial sitelayer include, but are not limited to: temperature measurement andcontrol, humidity measurement and control, and process control. Thedependency herein means that when the above-mentioned control program isimplemented on microkernels, it is determined that control programscorresponding to the above-mentioned control program are completed onthe basis of the microkernels. In fact, a micro control process acquiredthrough a preset algorithm may be an industrial control process inaccordance with the industrial site, or may be a user-defined industrialcontrol process.

In the preset algorithm, for example, different weights are set formicrokernel task type, running time and priority of a control program,and these weights are added up. The different sums of the weights, whichare in a certain range, are considered to correspond to a same controlprogram. The dependency is calculated through the preset algorithm, andcontrol programs with high dependency are combined to determine thenumber of control programs running on each physical core and eachcontrol program running on the plurality of physical cores.

The scheduling configuration information includes the number of controlprograms running on each physical core, the scheduling algorithm for allthe control programs running on each physical core, and at least onecontrol program running on more than one physical core. In the presentembodiment, after it is determined which control programs are allocatedto which physical cores according to the above method, schedulingconfiguration information is generated. In an example, with reference toFIG. 2, three control programs run on each of physical cores a, b and c.Specifically, three control programs a1, a2 and a3 run on the physicalcore a; three control programs b1, b2 and b3 run on the physical core b;and three control programs c1, c2 and c3 run on the physical core c. Thephysical core a determines from three control programs a1, a2, and a3one control program currently executing the kernel mode operation byusing the timetable-based scheduling algorithm. The physical core bdetermines from three control programs b1, b2, and b3 one controlprogram currently executing the kernel mode operation by using thepriority-based scheduling algorithm. The physical core c determines fromthree control programs c1, c2, and c3 one control program currentlyexecuting the kernel mode operation by using the priority-basedscheduling algorithm. The control programs b1, b2, c1 and c2 originatingfrom one control program run on two physical cores b and c respectively.

In step 102, the operating system kernel configures the control programsrunning on the operating system kernel according to the schedulingconfiguration information.

The operating system kernel virtualizes hardware through a virtualmachine monitoring program, and configures the control programs on oneof the plurality of physical cores according to the schedulingconfiguration information; and/or the operating system kernel configuresthe scheduling algorithm for the control programs running on the each ofthe plurality of physical cores according to the schedulingconfiguration information, the scheduling algorithm including atimetable-based scheduling algorithm or a priority-based schedulingalgorithm; and/or the operating system kernel virtualizes the pluralityof physical cores, obtains the control programs originating from atleast one control program of all the control programs and configures thecontrol programs on more than one the plurality of physical coresaccording to the scheduling configuration information.

The operating system kernel may actually configure control programsrunning on the operating system kernel according to the schedulingconfiguration information. In an example, with reference to FIG. 2,three control programs run on each of physical cores a, b and c.Specifically, three control programs a1, a2 and a3 run on the physicalcore a; three control programs b1, b2 and b3 run on the physical core b;and three control programs c1, c2 and c3 run on the physical core c. Thephysical core a determines from three control programs a1, a2, and a3one control program currently executing the kernel mode operation byusing the timetable-based scheduling algorithm. The physical core bdetermines from three control programs b1, b2, and b3 one controlprogram currently executing the kernel mode operation by using thepriority-based scheduling algorithm. The physical core c determines fromthree control programs c1, c2, and c3 one control program currentlyexecuting the kernel mode operation by using the priority-basedscheduling algorithm. The control programs b1, b2, c1 and c2 originatingfrom one control program run on two physical cores b and c respectively.

In step 103, the operating system kernel starts the configured controlprograms.

After performing the configuration described above, the operating systemkernel starts the configured control programs. In an example, withreference to FIG. 2, nine control programs are configured on threephysical cores and are scheduled according to the scheduling algorithmscorresponding to the respective physical cores.

In the present embodiment, each physical core may have multiple controlprograms running thereon, which improves the utilization of resources ofthe physical core; control programs with different periods may run onthe same physical core, which achieves the free combination of controlprograms across a plurality of physical cores and the multi-servicesoftware-defined free scheduling; and different scheduling algorithmsfor control programs may be configured for different physical coresfreely, which improves the flexibility and diversity of the schedulingof control programs.

In the present embodiment, prior to startup of a system, schedulingconfiguration information is generated according to the microkernel tasktype weight and the microkernel task priority weight and/or the controlprogram running time weight corresponding to control programs, thenumber and the scheduling algorithm of the control programs running oneach physical core and at least one control program running on more thanone of the plurality of physical cores are configured according to thescheduling configuration information. A user-defined configuration isnot limited to a single physical core controlling a plurality ofmicrokernel time slices and a single microkernel occupying computingresources to perform an allocation across physical cores. The presentdisclosure achieves the real-time control and free combination of themicrokernel control of the industrial server at the industrial sitelayer, and improves the utilization of the computing resources of thephysical cores.

Embodiment 2

On the basis of the above, a timetable-based scheduling algorithmincludes: setting a plurality of timers, where a duration of a firsttimer is a main frame time, a second timer is sequentially started foreach of a plurality of time windows within the main frame time, and theduration of the second timer is the same as the duration of each timewindow, successively; and scheduling control programs according to atimetable while starting the first timer and the second timer with amain frame time as a period, scheduling a next control program once thesecond timer expires, and starting a next period once the first timerexpires, where the timetable includes start time and end time of each ofthe plurality of time windows and the respective control programscorresponding to the time windows.

In the present embodiment, control programs running on a physical coreare scheduled according to the configured timetable. The timetable maybe pre-configured according to requirements. The scheduling is performedby taking a main frame time as a period, the main frame includingmultiple time windows. The timetable includes start time and end time ofthe each time windows, as well as a control programs corresponding toeach time window. The time windows are classified into non-idle timewindows and idle time windows. Each non-idle time window corresponds tothe running time of one control program, and no control program runs inthe idle time window. When control programs are scheduled, the mainframe time is repeatedly executed, that is, every time the timetable isfinished, the first time window of the timetable will be executed anew.FIG. 5 is a schematic diagram of a timetable according to the embodimentof the present disclosure. In this timetable, the first non-idle timewindow is the running time of the control program 1, the second non-idletime window is the running time of the control program 2, the thirdnon-idle time window is the running time of the control program 3, andthe fourth non-idle time window is again the running time of the controlprogram 1. The main frame time is the total duration of the six timewindows of FIG. 5. Users may configure, according to actualrequirements, the duration of each time window and the control programsrunning in each time window. The durations of the time windows may beconfigured to be the same or different.

However, since the timetable-based scheduling algorithm adopts thesystem clock, interruption may occur at small time intervals. Thefrequent occurrence of interruption may introduce delay to time windowsof the timetable. For example, suppose that the main frame time of thetimetable is 500 ms and the non-idle time window corresponding to thecontrol program 1 is 100 ms, and suppose that the interruptionprocessing time is 1 ms, if 10 interruptions occur during the running ofthe control program 1, then a delay of 10 ms is introduced, that is, thecontrol program 1 runs for 110 ms before switching to the controlprogram 2. Accordingly, when the main frame time of 500 ms expires, itis actually still in the last time window of the timetable and it willnot switch back to the first time window of the timetable until 510 msexpires, resulting in a delay of 10 ms for main frame switching. Toavoid the delay for control program switching and main frame switching,the plurality of timers are set in the present embodiment. The firsttimer is used for timing the main frame time to control the switching ofthe main frame time, and the second timer is used for timing the timewindows to control the switching of the time windows. With reference toFIG. 5, when a main frame starts, the first timer and the second timerare started at the same time, the control program 1 corresponding to thefirst time window in the timetable is scheduled. At the moment, theduration of the second timer is the same as that of the first timewindow. When the second timer expires, the first time window in thetimetable is switched to the adjacent second time window and the controlprogram 2 corresponding to the second time windows is scheduled. At themoment, the duration of the second timer is as same as the duration ofthe second time window. The rest can be done in the same manner. Whenthe first timer reaches expires, a next main frame period is started,that is, the control program 1 corresponding to the first time window inthe timetable is scheduled again. At the moment, the current timewindow, no matter which time window it is, switches to the first timewindow of the timetable, the first timer and the second timer are resetand restart, thereby achieving synchronization of the main frame time.

Embodiment 3

On the basis of the above, the priority of control programs running onone or more physical cores are acquired, and is represented by an 8-bitbinary number, where the most significant 3 bits represent a primaryindex number, and the least significant 5 bits represent a secondaryindex number. The corresponding bits in the priority primary indexnumber bitmap are marked according to the primary index number, and thecorresponding bits in the priority secondary index number bitmap aremarked according to the secondary index number.

In the present embodiment, each control program may be provided with apriority, which may be set in a range from 0 to 255, where 0 correspondsto the highest priority and 255 corresponds to the lowest priority. Eachcontrol program may be in different states such as ready, wait, pending,suspend or hibernate. Only a control program in the ready state can bescheduled, and control programs in other states are not included in thelist of objects to be scheduled. Each priority is represented by an8-bit binary number, where the most significant 3 bits represent aprimary index number, and the least significant 5 bits represent asecondary index number. For example, a control program with priority of42, which is represented by a binary number 00101010, is in the readystate. The most significant 3 bits are 001(1) and the least significant5 bits are 01010(10). The primary index number corresponding to thepriority 42 is 1, and the secondary index number corresponding to thepriority 42 is 10. FIG. 6 is a schematic diagram of a priority indexnumber bitmap according to an embodiment of the present disclosure. Thepriority primary index number bitmap is a 1×8 one-dimensional bitmap, inwhich the positions are numbered from 0 to 7. The priority secondaryindex number bitmap is an 8×32 two-dimensional bitmap, in which thepositions are numbered from 0 to 7 in vertical direction and from 0 to31 in horizontal direction. The position numbered as 1 in the priorityprimary index number bitmap has a mark (of 1) according to the primaryindex number 1 corresponding to the priority 42; the position numberedas 1 in vertical direction and 10 in horizontal direction in thepriority primary index number bitmap has a mark (of 1) according to thesecondary index number corresponding to the priority 42.

On the basis of the above, a priority-based scheduling algorithmincludes: traversing a priority primary index number bitmap to determinea primary index number corresponding to a highest priority; traversing apriority secondary index number bitmap corresponding to the primaryindex number to determine a secondary index number corresponding to thehighest priority; calculating the highest according to the primary indexnumber and the secondary index number, and determining a control programcorresponding to the highest priority.

With reference to FIG. 6, the priority primary index number bitmap istraversed in the order of 0 to 7 to find that the first position withthe mark of 1 is numbered as 1; then the priority secondary index numberbitmap is traversed in the order of 0 to 31 to find that the firstposition, which has the mark of 1 and is numbered as 1 in verticaldirection, is numbered as 10 in horizontal direction. According to thecomposition of the priority, the highest priority of the control programis 42 in this case.

Embodiment 4

FIG. 7 is a flow chart of a method for implementing microkernelarchitecture of industrial server according to an embodiment 4 of thepresent disclosure. In the embodiment, the operating system kernelgenerates scheduling configuration information according to amicrokernel task type weight, a microkernel task priority weight and/ora control program running time weight corresponding to each controlprogram and a service requirement of each control program. Withreference to FIG. 7, the method specifically includes steps describedbelow.

In step S710, before a system starts, an operating system kernelgenerates scheduling configuration information according to amicrokernel task type weight, a microkernel task priority weight and/ora control program running time weight corresponding to each controlprogram and a service requirement of each control program.

In an embodiment, the service requirement of each control programincludes a procedure requirement, a data requirement and a functionrequirement of each control program. In this embodiment, the servicerequirement of each control program is provided, in addition to themicrokernel task type weight, the microkernel task priority weightand/or the control program running time weight, to serve as the base forgenerating the scheduling configuration information. In a specificimplementation mode, the operating system kernel may generate thescheduling configuration information according to the microkernel tasktype weight, the microkernel task priority weight and the controlprogram running time weight corresponding to each control program, andthe service requirement of each control program. Alternatively, theoperating system kernel may generate the scheduling configurationinformation according to the microkernel task type weight and themicrokernel task priority weight corresponding to each control program,and the service requirement of each control program. Alternatively, theoperating system kernel may generate the scheduling configurationinformation according to the microkernel task type weight and thecontrol program running time weight corresponding to the controlprograms, and the service requirement of each control program. Theservice requirement of each control program may be control logic,control task, control target and the like to be implemented by thecontrol program. Particularly, in a distributed control system, theservice requirement of each control program may be used in the analysisfor the cooperation relationship such as a trigger condition among thecontrol programs and a service parameter or data to be transmitted amongthe control programs. In order to determine the physical core or thephysical cores to run the control programs and the number of controlprograms running on each physical core, the microkernel task typeweight, the microkernel task priority weight and the service requirementof the control programs may be combined to calculate the dependency ofmultiple control programs. Control programs having high dependency arecombined and configured on a same physical core, and control programshaving low dependency are configured on different physical cores.

The scheduling configuration information includes the number of controlprograms running on each physical core, scheduling algorithms forcontrol programs running on each physical core and the each controlprogram running on multiple physical cores.

In step S720, the operating system kernel configures the controlprograms running on the operating system kernel according to thescheduling configuration information.

In step S730, the operating system kernel starts the configured controlprograms.

In this embodiment, the operating system kernel generates the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and the control program runningtime weight corresponding to the control programs, and the servicerequirement of the control programs. In this way, the system can startaccording to the service requirement of the control programs, andimplement the inter-service and intra-service cooperation among thecontrol programs and the device cooperation among control subprogramsrunning on different physical cores on the basis of microkernelarchitecture. Here, each control subprogram in the device cooperationforms a complete control program.

In an optional implementation mode, one or more physical cores havemultiple control programs running thereon, and a service requirementexists among the control programs. As such, the scheduling configurationinformation includes the number of control programs running on eachphysical core, a scheduling algorithm for all control programs runningon each physical core, at least one control program running on multiplephysical core, and a trigger condition among control programs and/or aservice parameter delivered among control programs. The microkernelarchitecture is adopted for implementing inter-service cooperation. Ifmultiple control programs run on different physical cores, the devicecooperation among physical cores is implemented. The trigger conditionamong control programs may be interpreted to be a condition satisfied bya control program A when triggering running of another control programB, which is in cooperation with the control program A. The serviceparameter delivered among control programs may be interpreted to be aservice parameter required for the running of a control program B anddelivered from a control program A to the control program B, which is incooperation with the control program A. In an embodiment, the schedulingconfiguration information further includes information indicating to acontrol program the physical core for running another control program incooperation with the control program, and a trigger condition requiredfor triggering the another control program in cooperation and/or atrigger parameter required to be delivered to the another controlprogram in cooperation. Here, cooperation may refer to the cooperationbetween one control program and another control program, or may refer tothe cooperation between a control subprogram of one control program anda control subprogram of another control program.

One physical core may have one or more control programs running thereon;the one or more control programs may specifically run on one or morePLCs of one or more microkernels. In a case of multiple control programsrunning on one physical core, with reference to FIG. 2, three controlprograms a1, a2 and a3 run on the physical core a. The schedulingalgorithm of the 3 control programs includes a timetable-basedscheduling algorithm or a priority-based scheduling algorithm. This hasbeen illustrated in the above embodiments and will not be repeated. Itis assumed that every two control programs among the 3 control programsare in cooperation. The trigger condition and the service parameterinclude, for example, a trigger condition satisfied by the controlprogram a1 to trigger the running of the control program a2; a triggercondition satisfied by the control program a2 to trigger the running ofthe control program 3; an operation result of the control program a1 anda service parameter that are delivered from the control program a1 tothe control program a2 and are required for the running of the controlprogram a2; and an operation result of the control program a2 and aservice parameter that are delivered from the control program a2 to thecontrol program a3 and are required for the running of the controlprogram a3. In the case of one physical core running one controlprogram, with reference to FIG. 2, the physical core a runs the controlprogram a1, the physical core b runs the control program b1, thescheduling algorithm of the control programs a1 and b1 includes atimetable-based scheduling algorithm or a priority-based schedulingalgorithm. Since the control programs a1 and b1 are in cooperation, thetrigger condition and the service parameter include, for example, atrigger condition satisfied by the control program a1 to trigger therunning of the control program b1, and an operation result of thecontrol program a1 and a service parameter that are delivered from thecontrol program a1 to the control program b1 and are required for therunning of the control program b1.

The trigger condition and/or service parameter among control programsare illustrated in detail in an application scenario with reference toFIG. 8.

FIG. 8 illustrates control programs A and B. The dash line representsthe flow direction of the trigger condition, and the solid linerepresents the flow direction of the service parameter. Before startupof a system, the trigger condition and the service parameter aregenerated in advance and the control programs A and B are configured. Inthis way, the control programs A and B automatically implements theinter-service cooperation according to the configuration. It should benoted that after a triggered control program starts running, thetriggering control program may stop running or continue to run. Thespecific running manner of a control program is determined by theservice requirement of the control program.

In an example, the control program A is used for controlling a conveyerbelt, and the control program B is used for controlling a grabbingmechanical arm. When a certain condition is satisfied, the controlprogram for the conveyer belt needs to start the control program for thegrabbing mechanical arm to grab. Therefore, before the startup of thesystem, the control program for the conveyer belt is configured, so asto start the control program for the grabbing mechanical arm to grabwhen the condition is satisfied. In case that the control program of theconveyer belt need to inform the speed and force of the grabbing actionto the control program for the grabbing mechanical arm, the controlprogram for the conveyer belt so as to start the control program for thegrabbing mechanical arm to grab when the condition is satisfied. Inaddition, the speed and force of the grabbing action may be configuredto the control program for the grabbing mechanical arm in advance.

In another example, the control program A is used for charging, and thecontrol program B is used for heating. When the temperature of watercontained in a container reaches a preset condition, the control programfor charging needs to perform charging; and when the temperature doesnot reach the preset condition, the control program for heating isstarted to heat the water in the container. Before the startup of thesystem, the control program for charging is configured in advance insuch a manner that when the temperature of the water drops below apreset condition, the control program for heating is started to heat thewater in the container. In addition, the temperature range of the watermay be configured to the control program for heating in advance.

In another optional embodiment mode, there is at least one controlprogram, and each control program may be divided into multiple controlsubprograms. As such, the scheduling configuration information furtherincludes control subprograms of each control program, at least onephysical core running the control subprograms, and a trigger conditionand/or service parameter among the control subprograms. The controlsubprograms of each control program run on at least one physical core.The microkernel architecture is adopted for implementing inter-servicecooperation. The trigger condition among control subprograms may beinterpreted to be a condition satisfied by a control subprogram A whentriggering running of another control subprogram B, which is incooperation with the control subprogram A. The service parameterdelivered among control subprograms may be interpreted to be a serviceparameter required for the running of a control subprogram B anddelivered from a control subprogram A to the control subprogram B, whichis in cooperation with the control subprogram A. If multiple controlsubprograms of one control program run on different physical cores, thedevice cooperation among physical cores is implemented. In anembodiment, the scheduling configuration information further includesinformation indicating to a control program one or more physical coresfor running another control program in cooperation with the controlprogram, and a trigger condition required for triggering the controlprogram in cooperation and/or a trigger parameter required to be sent tothe control program in cooperation. The control subprograms incooperation here constitute a complete control program.

It should be noted that one physical core may run control subprograms ofdifferent control programs, or control subprograms of a same controlprogram.

For the control subprograms of each control program, one physical coremay have one or more control subprograms running thereon; the one ormore control subprograms may specifically run on on one or more PLCs ofone or more microkernels. In a case of one physical core with one ormore control subprograms running thereon, with reference to FIG. 2, thephysical core a have three control subprograms a1, a2 and a3 running,and three control subprograms constitute one control program. Thescheduling algorithm of the 3 control subprograms includes atimetable-based scheduling algorithm or a priority-based schedulingalgorithm. The trigger condition and the service parameter include, forexample, a trigger condition satisfied by the control subprogram a1 totrigger the running of the control subprogram a2; a trigger conditionsatisfied by the control subprogram a2 to trigger the running of thecontrol subprogram 3; an operation result of the control subprogram a1and a service parameter which are delivered from the control subprograma1 to the control subprogram a2 and are required for the running of thecontrol subprogram a2; and an operation result of the control subprograma2 and a service parameter which are delivered from the controlsubprogram a2 to the control subprogram a3 and are required for therunning of the control subprogram a3. In the case of one physical corehaving one control subprogram running thereon, with reference to FIG. 2,the physical core a runs the control subprogram a1, the physical core bruns the control subprogram b1, the scheduling algorithm of the controlsubprograms a1 and b1 includes a timetable-based scheduling algorithm ora priority-based scheduling algorithm. The trigger condition and theservice parameter include, for example, a trigger condition satisfied bythe control subprogram a1 to trigger the running of the controlsubprogram b1, and an operation result of the control subprogram a1 anda service parameter delivered from the control subprogram a1 to thecontrol subprogram b1 and are required for the running of the controlsubprogram b1.

The trigger condition and/or service parameter among control subprogramsare illustrated in detail in an application scenario with reference toFIG. 9.

In FIG. 9, the control program A includes control subprogram a1, a2 anda3. The control subprogram a1 is configured on a PLC1 of a physical corea, the control subprogram a2 is configured on a PLC2 of a physical coreb, and the control subprogram a3 is configured on a PLC3 of a physicalcore c. In an embodiment, each of the physical cores further includes acommunication functional block. The communication functional block isused for delivering the trigger condition and the service parameteramong the control subprograms, and is equivalent to “input” or “output”of each PLC in the procedure of the control program. The dash linerepresents the flow direction of the trigger condition, and the solidline represents the flow direction of the service parameter. Before thestartup of a system, the trigger condition and the service parameter aregenerated in advance and the control subprograms a1, a2 and a3 areconfigured, such that the control subprograms a1, a2 and a3automatically implement the device cooperation among the physical cores.It should be noted that after a triggered control subprogram startsrunning, the triggering control subprogram may stop running or continueto run. The specific running manner of a control subprogram isdetermined by the service requirement of the control subprogram.

For example, in the pre-configuration, an initial value of the controlsubprogram a1 is configured, an operation result of the controlsubprogram a1 serves as a trigger condition of the control subprograma2, the operation result of the control subprogram a1 and an operationresult of the control subprogram a2 serve as a trigger condition of thecontrol subprogram a3, and the operation result of the controlsubprogram a1 serves as a trigger condition of the control subprograma1.

Specifically, the control subprogram a1 performs calculation based onthe initial value preconfigured and delivers the operation result to thecontrol subprograms a2 and a3 through the communication functionalblock. The control subprogram a2 performs calculation based on theoperation result of the control subprogram a1 received through thecommunication functional block. The control subprogram a3 performscalculation based on the operation results of the control subprograms a1and a2 received through the communication functional block and obtains afinal result.

In an embodiment, one control program may be divided into multiplecontrol subprograms in various manners, for example, the two-layerclipping algorithm in above embodiments. In this implementation mode,the control program is divided into control subprograms according to theresource requirement of the control program and the computing resourceprovided by the microkernel. As such, the step in which the operatingsystem kernel generates scheduling configuration information accordingto a microkernel task type weight, a microkernel task priority weightand/or a control program running time weight corresponding to controlprograms and a service requirement of each control program furtherincludes that the operating system kernel divides each control programinto multiple control subprograms according to resource requirements ofthe control programs and computing resources provided by themicrokernel; and the operating system kernel generates the schedulingconfiguration information according to the microkernel task type weightand the microkernel task priority weight and/or the control programrunning time weight corresponding to each control subprogram, andservice requirement of each control subprogram.

The resource requirements of the control programs include computationburden of each control program or the number of I/O interfaces of eachcontrol program. The computation burden of each control program includesmemory size, the number of instructions and the number of processes.Accordingly, the computation resources provided by the microkernelinclude a parameter for weighting computational capability or the numberof I/O interfaces. The parameter for weighting computational capabilityincludes memory size, basic frequency, storage space and the like. Assuch, the operating system kernel divides the control program intomultiple control subprograms according to the computation burden of thecontrol program and the parameter for weighting computational capabilityprovided by the microkernel in each physical core. Alternatively, theoperating system kernel divides the control program into multiplecontrol subprograms according to the number of I/O interfaces of theeach control program and the number of I/O interfaces of the microkernelin each physical core.

In addition, after the control program is divided, the dependency of I/Ointerfaces of the control subprograms is calculated. This dependency ofI/O interfaces may be weighted by means of the number of I/O interfacesamong control subprograms in direct connection. The control subprogramswith dependency of I/O interfaces higher than a preset dependencythreshold are configured on a same physical core or on multiple physicalcores close to each other geologically, so as to shorten the distance ofdata transmission.

In yet another implementation mode, there may be at least one controlprogram, and each control program includes at least one basic programblock. The basic program block is the minimal software unit forexecuting control logic, and is ultimately manifested as input/output ofthe trigger condition and input/output of the service parameter. Thebasic program blocks of the control program and the trigger conditionand/or service parameter among the basic program blocks may be generatedand configured prior to the startup of the system. In an embodiment, thestep in which the operating system kernel generates the schedulingconfiguration information according to the microkernel task type weightand the microkernel task priority weight and/or the control programrunning time weight corresponding to each control program as well as aservice requirement of each control program includes that the operatingsystem kernel generates the scheduling configuration informationaccording to the microkernel task type weight and the microkernel taskpriority weight and/or the control program running time weightcorresponding to each control program, the service requirement of eachcontrol program, and basic program blocks of the system. The schedulingconfiguration information further includes all basic program blocks ineach control program, and a trigger condition and/or service parameteramong the basic program blocks in each control program, so as toimplement the intra-service cooperation. The trigger condition amongbasic control programs may be interpreted to be a condition satisfied bya basic control program A when triggering running of another basiccontrol program B, which is in cooperation with the basic controlprogram A. The service parameter delivered among basic control programsmay be interpreted to be a service parameter required for the running ofa basic control program B and delivered from a basic control program Ato the basic control program B, which is in cooperation with the basiccontrol program A.

Generally, as shown in FIGS. 8 and 9, the basic program blocks areincluded in the control subprograms or the control program. In anexample as shown in FIG. 9, the control subprogram a1 includes basicprogram blocks 1, 2 and 3, and the control subprogram a2 includes basicprogram blocks 4 and 2. In another example as shown in FIG. 8, thecontrol program A includes basic program blocks 1, 4 and 5, and thecontrol program B includes basic program blocks 2, 4 and 1. It can beseen that one basic program block may be reused in different controlsubprograms or control programs. Accordingly, it is the controlsubprogram or control program including a basic program block whichdetermines the location where the basic program block is configured onthe physical cores. The location of the control subprograms or controlprogram is illustrated in the above embodiments and will not be repeatedhere.

With reference to FIGS. 8, 9 and 10, the dash line between basic programblocks represents the flow direction of the trigger condition, and thesolid line between basic program blocks represents the flow direction ofthe service parameter. Before the startup of the system, the basicprogram blocks corresponding to each control program is selected inadvance, and the trigger condition and service parameter among the basicprogram blocks are generated. After that, the basic program blocks areconfigured and then start automatically. In this way, the entire controlprogram is implemented.

In FIG. 10, the basic program blocks (e.g., basic program blocks 1, 2and 3) included in the control program are configured in advance, andthe initial values of the basic program blocks 1 and 2 are configured.Furthermore, the operation result of the basic program block 1 serves asthe trigger condition of the basic program block 2, and the operationresults of the basic program blocks 1 and 2 serve as the triggercondition of the basic program block 3.

The basic program block 1 performs calculation based on the initialvalue preconfigured and delivers the operation result to the basicprograms 2 and 3. The basic program block 2 performs calculation basedon the initial value preconfigured and the operation result of the basicprogram block 1, and delivers the operation result to the basic programblock 3. The basic program block 3 performs calculation based on theoperation results of the basic program blocks 2 and 1 and obtains anoperation result of the control program.

Embodiment 5

FIG. 11 is a structural diagram of an apparatus for implementingmicrokernel architecture of industrial server according to an embodimentof the present disclosure. The apparatus is disposed in an industrialserver shown in FIG. 2 and includes a generating module 11, aconfiguration module 12 and a starting module 13. The generating module11 is used for, prior to startup of a system, generating schedulingconfiguration information according to a microkernel task type weightand a microkernel task priority weight and/or a control program runningtime weight corresponding to control programs. The schedulingconfiguration information includes the number of control programsrunning on each physical core, scheduling algorithms for controlprograms running on each physical core, and each control program runningon multiple physical cores. The configuration module 12 is used forconfiguring control programs running on the operating system kernelaccording to the scheduling information. The starting module 13 is usedfor starting the configured control programs.

The apparatus for implementing microkernel architecture of industrialserver provided by the embodiment of the present disclosure is capableof performing the method for implementing microkernel architecture ofindustrial server according to any embodiment of the present disclosureand has functional modules and beneficial effects corresponding to themethod.

Embodiment 6

FIG. 12 is a structural diagram of an industrial server according to anembodiment of the present disclosure. As shown in FIG. 8, the industrialserver includes a processor 20, a memory 21, an input device 22 and anoutput device 23. The number of processors 20 in the industrial servermay be one or more and one processor 20 is taken as an example in FIG.8. The processor 20, the memory 21, the input device 22 and the outputdevice 23 in the industry server may be connected through a bus or inother ways. In FIG. 8, the connection through a bus is taken as anexample.

As a computer-readable storage medium, the memory 21 is used for storingsoftware programs and computer-executable programs and modules, such asprogram instructions/modules corresponding to the method forimplementing microkernel architecture of industrial server in theembodiments of the present disclosure. The processor 20 runs softwareprograms, instructions and modules stored on the memory 21 to executevarious function applications and data processing of the industrialserver, that is, to implement the method for implementing microkernelarchitecture of an industrial server.

The memory 21 may mainly include a program storage area and a datastorage area. The program storage area may store an operating system andan application program required for implementing at least one functionwhile the data storage area may store data created depending on use ofterminals. In addition, the memory 21 may include a high-speed randomaccess memory, and may also include a nonvolatile memory, such as atleast one dick memory, flash memory or another nonvolatile solid-statememory. In some examples, the memory 21 may further include memoriesthat are remotely disposed with respect to the processor 20. Theseremote memories may be connected to the industrial server via a network.The network includes, but is not limited to, the Internet, an intranet,a local area network, a mobile communication network and a combinationthereof.

The input device 22 may be used for receiving inputted digital orcharacter information and for generating key signal input related touser settings and function control of the industrial server. The outputdevice 23 may include a display device such as a display screen.

Embodiment 7

Embodiments of the present disclosure further provide a storage mediumcontaining executable instructions. The executable instructions, whenexecuted by a processor, execute related operations in the method forimplementing microkernel architecture of industrial server provided byany embodiment of the present disclosure.

From the above description of embodiments, it will be apparent to thoseskilled in the art that the embodiments of the present disclosure may beimplemented by means of software and necessary general-purpose hardware,or may of course be implemented by hardware, but in many cases theformer is a preferred. Based on this understanding, the presentdisclosure substantially may be embodied in the form of a softwareproduct. The software product is stored in a computer-readable storagemedium, such as a computer floppy disk, a Read-Only Memory (ROM), aRandom Access Memory (RAM), a flash memory, a hard disk or an opticaldisk, and includes instructions for enabling a computer device (whichmay be a personal computer, a server or a network device) to execute themethod according to each embodiment of the present disclosure.

It is to be noted that units and modules involved in the embodiment ofthe above mentioned apparatus are just divided according to functionallogic, and the division is not limited to this, as long as thecorresponding functions can be realized. In addition, the specific namesof the each functional unit are just intended for distinguishing, andare not to limit the protection scope of the embodiments of the presentdisclosure.

It is to be noted that the above are only preferred embodiments of thepresent disclosure and the technical principles used therein. It will beunderstood by those skilled in the art that the present disclosure isnot limited to the specific embodiments described herein. Those skilledin the art can make various apparent modifications, adaptations andsubstitutions without departing from the scope of the presentdisclosure. Therefore, while the present disclosure has been describedin detail via the above-mentioned embodiments, the present disclosure isnot limited to the above-mentioned embodiments and may include moreother equivalent embodiments without departing from the concept of thepresent disclosure.

What is claimed is:
 1. A method for implementing microkernelarchitecture of industrial server, wherein the method is applied to anindustrial server, an operating system kernel based on industrial serverhardware in the industrial server supports a plurality of physicalcores, and the method comprises: operating an operating system kernel togenerate scheduling configuration information according to a microkerneltask type weight and a microkernel task priority weight and/or a controlprogram running time weight corresponding to each control program of aplurality of control programs prior to startup of a system, wherein thescheduling configuration information comprises a number of controlprograms of the plurality of control programs running on each physicalcore of the plurality of physical cores, a scheduling algorithm for allthe control programs running on the each physical core, and at least onecontrol program of the plurality of control programs running on morethan one of the plurality of physical cores; operating the operatingsystem kernel to configure the plurality of control programs running onthe operating system kernel according to the scheduling configurationinformation; and operating the operating system kernel to start theconfigured control programs.
 2. The method according to claim 1, whereinoperating the operating system kernel to configure the plurality ofcontrol programs running on the operating system kernel according to thescheduling configuration information comprises: virtualizing hardwarethrough a virtual machine monitoring program, and configuring more thanone of the plurality of control programs on at least one of theplurality of physical cores according to the scheduling configurationinformation; and/or configuring the scheduling algorithm for all thecontrol programs running on the each physical core according to thescheduling configuration information, wherein the scheduling algorithmcomprises a timetable-based scheduling algorithm or a priority-basedscheduling algorithm; and/or virtualizing the plurality of physicalcores, obtaining at least two control programs from each of the at leastone control program and configuring the obtained at least two controlprograms originating from each of the at least one control program onmore than one of the plurality of physical cores according to thescheduling configuration information.
 3. The method according to claim1, wherein operating the operating system kernel to generate thescheduling configuration information according to the microkernel tasktype weight and the microkernel task priority weight and/or the controlprogram running time weight corresponding to the each control program ofthe plurality of control programs comprises: generating the schedulingconfiguration information according to a microkernel task type, and amicrokernel task priority and/or a control program running time of theeach control program using a coarse-grained lock scheduling method,wherein in the coarse-grained lock scheduling method, the each physicalcore corresponds to one lock, one control program is determined from thecontrol programs on a single one of the plurality of physical coresaccording to a timetable-based scheduling algorithm or a priority-basedscheduling algorithm, the control program obtains the lock correspondingto the single one of the plurality of physical cores, exclusivelyoccupies the single one of the plurality of physical cores, and executesa kernel mode operation; or generating the scheduling configurationinformation according to the microkernel task type, and the microkerneltask priority and/or the control program running time of the eachcontrol program by using a fine-grained lock scheduling method, whereinin the fine-grained lock scheduling method, the each physical corecorresponds to the one lock, control programs are obtained from the atleast one control program according to computing resources required bythe at least one control program and are configured on respective onesof the plurality of physical cores according to the dependency among thecontrol programs, each of the control programs acquires a lockcorresponding to the respective one of the plurality of physical coresrunning the each of the control programs, the control programs havinglocks concurrently execute the kernel mode operation on the respectiveones of the plurality of physical cores running the control programs soas to be executed in parallel.
 4. The method according to claim 2,wherein the timetable-based scheduling algorithm comprises: setting aplurality of timers, wherein a duration of a first timer is a main frametime, a second timer is sequentially started for each of a plurality oftime windows within the main frame time, and a duration of the secondtimer is the same as a duration of each of the plurality of time windowssuccessively; and scheduling the control programs according to atimetable while starting the first timer and the second timer with themain frame time as a period, scheduling a next one of the controlprograms once the second timer expires, and starting a next period oncethe first timer expires, wherein the timetable includes start time andend time of each of the plurality of time windows and the respectivecontrol programs corresponding to the plurality of time windows.
 5. Themethod according to claim 1, wherein operating the operating systemkernel to generate the scheduling configuration information according tothe microkernel task type weight and the microkernel task priorityweight and/or the control program running time weight corresponding tothe each control program of the plurality of control programs includes:operating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and/or the control program runningtime weight corresponding to the each control program, and a servicerequirement of the each control program.
 6. The method according toclaim 5, wherein the scheduling configuration information furtherincludes a trigger condition and/or service parameter among theplurality of control programs.
 7. The method according to claim 5,wherein the scheduling configuration information further includes aplurality of control subprograms of the each control program, at leastone physical core running the control subprograms, and a triggercondition and/or service parameter among the control subprograms;wherein the control subprograms of the each control program run on theat least one physical core.
 8. The method according to claim 7, whereinoperating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and/or the control program runningtime weight corresponding to the each control program, and the servicerequirement of the each control program includes: for the each controlprogram, operating the operating system kernel to divide the eachcontrol program into the plurality of control subprograms according to aresource requirement of the each control program and computing resourcesof each microkernel; and operating the operating system kernel togenerate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol subprogram of the plurality of control subprograms, and aservice requirement of the each control subprogram.
 9. The methodaccording to claim 8, wherein for the each control program, operatingthe operating system kernel to divide the each control program into theplurality of control subprograms according to the resource requirementof the each control program and the computing resources of eachmicrokernel includes: for the each control program, operating theoperating system kernel to divide the each control program into theplurality of control subprograms according to a computation burden ofthe each control program and a parameter for weighting computationalcapability of each microkernel in the plurality of physical cores; orfor the each control program, operating the operating system kernel todivide the each control program into the plurality of controlsubprograms according to a number of I/O interfaces of the each controlprogram and a number of I/O interfaces of the each microkernel in theplurality of physical cores.
 10. The method according to claim 5,wherein operating the operating system kernel to generate the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and/or the control program runningtime weight corresponding to the each control program, and the servicerequirement of the each control program includes: operating theoperating system kernel to generate the scheduling configurationinformation according to the microkernel task type weight and themicrokernel task priority weight and/or the control program running timeweight corresponding to the each control program, the servicerequirement of the each control program and a plurality of basic programblocks of the system, wherein the scheduling configuration informationfurther includes: all basic program blocks in the each control program,and a trigger condition and/or service parameter among the basic programblocks in the each control program.
 11. An apparatus for implementingmicrokernel architecture of industrial server, wherein the apparatus isintegrated in an industrial server, an operating system kernel based onindustrial server hardware in the industrial server supports a pluralityof physical cores, wherein the apparatus comprises: a processor; and amemory for storing instructions executable to the process, wherein theprocessor is configured to: generate scheduling configurationinformation according to a microkernel task type weight and amicrokernel task priority weight and/or a control program running timeweight corresponding to each control program of a plurality of controlprograms prior to startup of a system, wherein the schedulingconfiguration information comprises a number of control programs of theplurality of control programs running on each physical core of theplurality of physical cores, a scheduling algorithm for all the controlprograms running on the each physical core, and at least one controlprogram of the plurality of control programs running on more than one ofthe plurality of physical cores; configure the plurality of controlprograms running on the operating system kernel according to thescheduling configuration information; and start the configured controlprograms.
 12. The apparatus according to claim 11, in the configurationof the plurality of control programs running on the operating systemkernel according to the scheduling configuration information, theprocessor is configured to: virtualize hardware through a virtualmachine monitoring program, and configure more than one of the pluralityof control programs on at least one of the plurality of physical coresaccording to the scheduling configuration information; and/or configurethe scheduling algorithm for all the control programs running on theeach physical core according to the scheduling configurationinformation, wherein the scheduling algorithm comprises atimetable-based scheduling algorithm or a priority-based schedulingalgorithm; and/or virtualize the plurality of physical cores, obtain atleast two control programs from each of the at least one control programand configure the obtained at least two control programs originatingfrom each of the at least one control program on more than one of theplurality of physical cores according to the scheduling configurationinformation.
 13. The apparatus according to claim 11, wherein in thegeneration of the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to the eachcontrol program of the plurality of control programs, the processor isconfigured to: generate the scheduling configuration informationaccording to a microkernel task type, and a microkernel task priorityand/or a control program running time of the each control program usinga coarse-grained lock scheduling method, wherein in the coarse-grainedlock scheduling method, the each physical core corresponds to one lock,one control program is determined from the control programs on a singleone of the plurality of physical cores according to a timetable-basedscheduling algorithm or a priority-based scheduling algorithm, thecontrol program obtains the lock corresponding to the single one of theplurality of physical cores, exclusively occupies the single one of theplurality of physical cores, and executes a kernel mode operation; orgenerate the scheduling configuration information according to themicrokernel task type, and the microkernel task priority and/or thecontrol program running time of the each control program by using afine-grained lock scheduling method, wherein in the fine-grained lockscheduling method, the each physical core corresponds to the one lock,control programs are obtained from the at least one control programaccording to computing resources required by the at least one controlprogram and are configured on respective ones of the plurality ofphysical cores according to the dependency among the control programs,each of the control programs acquires a lock corresponding to therespective one of the plurality of physical cores running the each ofthe control programs, the control programs having locks concurrentlyexecute the kernel mode operation on the respective ones of theplurality of physical cores running the control programs so as to beexecuted in parallel.
 14. The apparatus according to claim 12, whereinthe timetable-based scheduling algorithm comprises: setting a pluralityof timers, wherein a duration of a first timer is a main frame time, asecond timer is sequentially started for each of a plurality of timewindows within the main frame time, and a duration of the second timeris the same as a duration of each of the plurality of time windowssuccessively; and scheduling the control programs according to atimetable while starting the first timer and the second timer with themain frame time as a period, scheduling a next one of the controlprograms once the second timer expires, and starting a next period oncethe first timer expires, wherein the timetable includes start time andend time of each of the plurality of time windows and the respectivecontrol programs corresponding to the plurality of time windows.
 15. Theapparatus according to claim 11, wherein in the generation of thescheduling configuration information according to the microkernel tasktype weight and the microkernel task priority weight and/or the controlprogram running time weight corresponding to the each control program ofthe plurality of control programs, the processor is configured to:generate the scheduling configuration information according to themicrokernel task type weight, the microkernel task priority weightand/or the control program running time weight corresponding to the eachcontrol program, and a service requirement of the each control program.16. The apparatus according to claim 15, wherein the schedulingconfiguration information further includes a trigger condition and/orservice parameter among the plurality of control programs.
 17. Theapparatus according to claim 15, wherein the scheduling configurationinformation further includes a plurality of control subprograms of theeach control program, at least one physical core running the controlsubprograms, and a trigger condition and/or service parameter among thecontrol subprograms; wherein the control subprograms of the each controlprogram run on the at least one physical core.
 18. The apparatusaccording to claim 17, wherein in the generation of the schedulingconfiguration information according to the microkernel task type weight,the microkernel task priority weight and/or the control program runningtime weight corresponding to the each control program, and the servicerequirement of the each control program, the processor is configured to:for the each control program, divide the each control program into theplurality of control subprograms according to a resource requirement ofthe each control program and computing resources of each microkernel;and generate the scheduling configuration information according to themicrokernel task type weight and the microkernel task priority weightand/or the control program running time weight corresponding to eachcontrol subprogram of the plurality of control subprograms, and aservice requirement of the each control subprogram.
 19. The apparatusaccording to claim 18, wherein for the each control program, in thedivision of the each control program into the plurality of controlsubprograms according to the resource requirement of the each controlprogram and the computing resources of each microkernel, the processoris configured to: for the each control program, divide the each controlprogram into the plurality of control subprograms according to acomputation burden of the each control program and a parameter forweighting computational capability of each microkernel in the pluralityof physical cores; or for the each control program, divide the eachcontrol program into the plurality of control subprograms according to anumber of I/O interfaces of the each control program and a number of I/Ointerfaces of the each microkernel in the plurality of physical cores.20. The apparatus according to claim 15, wherein in the generation ofthe scheduling configuration information according to the microkerneltask type weight, the microkernel task priority weight and/or thecontrol program running time weight corresponding to the each controlprogram, and the service requirement of the each control program, theprocessor is configured to: generate the scheduling configurationinformation according to the microkernel task type weight and themicrokernel task priority weight and/or the control program running timeweight corresponding to the each control program, the servicerequirement of the each control program and a plurality of basic programblocks of the system, wherein the scheduling configuration informationfurther includes: all basic program blocks in the each control program,and a trigger condition and/or service parameter among the basic programblocks in the each control program.